#!/bin/sh#!/bin/sh
###############################################################################
## File: make_tar
##
## Builds the AW release package.
## First makes a directory with the name of the release. 
## Then copies in the relevant files, tars it, and deletes it. 
## It also builds the project, in case java.jar is not present.
###############################################################################
P=AW_1_0
echo "+++ Create " $P

echo "++++Make sure you are on ECO"
echo "Are you on ECO? y/n"
read answer
if [ "$answer" != "y" ]
then 
exit
fi 


if [ -d $P ]
then
echo "$P exists; delete? y/n"
read answer
if [ "$answer" != "y" ]
then 
exit
fi 
fi

echo "Make jar"
rm -Rf $P
mkdir $P
cd java
make
cd ..

echo "Copy files to $P"
if [ -f $P.tar.gz ]
then
rm $P.tar.gz
fi
if [ -f $P.tar ]
then
rm $P.tar
fi

cp  runAW $P
cp  viewAW $P
cp  buildAW $P
cp  README $P
cp  LICENSE $P
cp  HOSTS.cfg.release $P/HOSTS.cfg
cp -R demo $P
mkdir $P/projects
mkdir $P/projects/demo
cp projects/demo/AW.cfg $P/projects/demo

mkdir $P/java
cp -R java/jars $P/java/jars

## tar without source
echo "Make tar with demo"
tar cf  $P.tar $P --exclude=".svn" --exclude="*.removed"

## add src and tar
echo "Make tar with demo and source"
cp -R java/src $P/java
cp -R java/classes_ext $P/java
cp java/manifest.add $P/java
cp java/Makefile.release $P/java/Makefile

mkdir $P/java/classes
tar cf  $P.src.tar $P --exclude=".svn" --exclude="*.removed"

echo "Remove $P"
rm -Rf $P
